home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1999 #2 / Amiga Plus CD - 1999 - No. 2.iso / System-Boost / Grafik / MetaView / ARexx-Examples / WordWorth_Import_Gfx.rexx < prev   
OS/2 REXX Batch file  |  1998-11-08  |  2KB  |  77 lines

  1. /* Graphik Import in WordWorth mittels MetaView */
  2.  
  3. METAVIEW = ':Aminet/MetaView/MetaView' /* Please complete the path */
  4.  
  5. OPTIONS RESULTS
  6. SIGNAL ON FAILURE
  7. SIGNAL ON SYNTAX
  8.  
  9. /*
  10. ** Looking for our start process
  11. */
  12.  
  13. WWPORT = ADDRESS()
  14. say WWPORT
  15. if (LEFT(WWPORT, 9) ~= "WORDWORTH") then do /* not started from WordWorth */
  16.     say "Please start me from WordWorth!"
  17.     EXIT
  18. end
  19.  
  20. /*
  21. ** Create a new Metaview process:
  22. ** first look for the allready running processes
  23. ** then the new Port will be the next one
  24. */
  25.  
  26. do NUMBER = 0 to 20
  27.     if (SHOW(PORTS,"METAVIEW." || NUMBER) = 0) then
  28.     leave
  29. end
  30.  
  31. /*
  32. ** Searching for MetaView: 1. our path above,
  33. **    2. path in env:MetaView.path
  34. ** or 3. you must have a assign "MetaView:"
  35. */
  36.  
  37. if (EXISTS(METAVIEW)=0) then do
  38.     if OPEN("MVVAR","env:MetaView.path","Read") then do
  39.         METAVIEW = READLN("MVVAR")
  40.     end
  41.     if (EXISTS(METAVIEW)=0) then do
  42.         METAVIEW = "MetaView:MetaView"
  43.     end
  44. end
  45.  
  46. OPTIONS FAILAT 5                              /* enable warnings for WaitForPort */
  47. ADDRESS COMMAND
  48.     "run " || METAVIEW || " NODISPLAY"
  49.     MVPORT = "METAVIEW." || NUMBER
  50.     "WaitForPort " || MVPORT
  51.  
  52. OPTIONS FAILAT 21                             /* ignore errors */
  53.  
  54. ADDRESS VALUE WWPORT
  55.     REQUESTFILE PATH "Bilder:" TITLE "Please select GFX file"
  56.     FILENAME = result
  57.  
  58. ADDRESS VALUE MVPORT
  59.     LOAD FILENAME
  60.     SAVE "t:test.cgm" AS CGM
  61.     QUIT
  62.  
  63. ADDRESS VALUE WWPORT
  64.     REQUESTNOTIFY PROMPT "Please select >t:test.cgm<."
  65.     PLACEPICTURE
  66.  
  67. EXIT
  68.  
  69. FAILURE:
  70.     ADDRESS VALUE WWPORT
  71.     REQUESTNOTIFY PROMPT "Can't find" METAVIEW "!"
  72.     EXIT
  73.  
  74. SYNTAX:
  75.     say "Error on line" SIGL ":" ERRORTEXT(RC) "!"
  76.     EXIT
  77.